import { defineStore } from 'pinia';

export const LoginStore = defineStore('login', {
  state: () => {
    return { 
        id: '',
        name: '',
        group: ''
    }
  },
  getters: {
    getInfo: state => {
        return {
            id: state.id,
            name: state.name,
            group: state.group
        }
    },
  },
  actions: {
    set(user) {
        this.id = user.id;
        this.name = user.name;
        this.group = user.group;
    },
  },
  persist: true
});